package com.tengju.user.infrastructure.persistence.mybatis.mapper.dealer.custom;

import com.tengju.user.infrastructure.persistence.mybatis.dataobject.StaffSentimentCountDO;
import com.tengju.user.infrastructure.persistence.mybatis.dataobject.UserSentimentDO;
import org.apache.ibatis.annotations.Param;

import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;

/**
 * @author: Dylan
 * @date: 2021/8/16 11:48 上午
 */
public interface UserSentimentDOMapper {

    List<UserSentimentDO> selectBySsoUserIds(@Param("createTimeFrom") LocalDateTime createTimeFrom,
                                             @Param("createTimeTo") LocalDateTime createTimeTo,
                                             @Param("ssoUserIds") List<Long> ssoUserIds);

    List<UserSentimentDO> selectByIdCodes(@Param("idCodes") List<Long> idCodes);


    List<StaffSentimentCountDO> getStaffSentimentCount(@Param("ssoUserIds") List<Long> ssoUserIds,
                                                       @Param("startDayMin") LocalDateTime startDayMin,
                                                       @Param("nextDayMin") LocalDateTime nextDayMin,
                                                       @Param("virtualTable") String virtualTable,
                                                       @Param("noRecord") boolean noRecord,
                                                       @Param("offset") int offset,
                                                       @Param("limit") int limit);

    int getStaffSentimentCountTotal(@Param("ssoUserIds") List<Long> ssoUserIds,
                                    @Param("startDayMin") LocalDateTime startDayMin,
                                    @Param("nextDayMin") LocalDateTime nextDayMin,
                                    @Param("virtualTable") String virtualTable,
                                    @Param("noRecord") boolean noRecord);


    List<UserSentimentDO> getStaffSentimentRecordListByPage(@Param("ssoUserIds") List<Long> ssoUserIds,
                                                            @Param("startDayMin") LocalDateTime startDayMin,
                                                            @Param("nextDayMin") LocalDateTime nextDayMin,
                                                            @Param("serviceProviderId") Long serviceProviderId,
                                                            @Param("offset") int offset,
                                                            @Param("limit") int limit);


    int getStaffSentimentRecordTotal(@Param("ssoUserIds") List<Long> ssoUserIds,
                                     @Param("startDayMin") LocalDateTime startDayMin,
                                     @Param("nextDayMin") LocalDateTime nextDayMin,
                                     @Param("serviceProviderId") Long serviceProviderId);

    int addSentimentRecord(UserSentimentDO userSentimentDO);

    int deleteSentimentRecord(@Param("sentimentId") long sentimentId);

    UserSentimentDO getSentimentRecordBySentimentId(@Param("sentimentId") Long sentimentId);

    int updateSentimentRecord(@Param("sentimentId") long sentimentId, @Param("sentimentContext") String sentimentContext,
                              @Param("ssoUserId") long ssoUserId, @Param("operator") String operator);


    List<Map<String, Object>> getMonthSentimentRecordChart(@Param("ssoUserIds") List<Long> ssoUserIds,
                                                           @Param("startMonthMin") LocalDateTime startMonthMin,
                                                           @Param("nextMonthMin") LocalDateTime nextMonthMin,
                                                           @Param("virtualTable") String virtualTable);

}
